//
//  DDDADZYSDKViewController.m
//  DDDAdZYSdk
//
//  Created by summerthread on 09/17/2020.
//  Copyright (c) 2020 summerthread. All rights reserved.
//

#import "DDDADZYSDKViewController.h"
#import "DDDAdZYSdkBannerVC.h"
#import "DDDAdZYSdkRewardVideoVC.h"


@interface DDDADZYSDKViewController ()
@property (nonatomic, strong) UIButton *textBtn;

@property (nonatomic, strong) UIButton *bannerBtn;

@property (nonatomic, strong) UIButton *bannerTextBtn;

@property (nonatomic, strong) UITextField *changeLoadNumberTextField;
@end

@implementation DDDADZYSDKViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.navigationItem.title = @"中彦sdk";
    [self.view addSubview:self.changeLoadNumberTextField];
    [self.view addSubview:self.textBtn];
    [self.view addSubview:self.bannerBtn];
    [self.view addSubview:self.bannerTextBtn];
    
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

#pragma mark-- 点击事件
- (void)clickBtnAction:(UIButton *)sender {
    [self.view endEditing:YES];
    NSString *number = @"1";
    if (self.changeLoadNumberTextField.text.length > 0) {
        number = self.changeLoadNumberTextField.text;
    }
    switch (sender.tag) {
        case 10:
            {
                DDDAdZYSdkRewardVideoVC *vc = [[DDDAdZYSdkRewardVideoVC alloc]init];
                [self.navigationController pushViewController:vc animated:YES];
            }
            break;
        case 20:
            {
                DDDAdZYSdkBannerVC *vc = [[DDDAdZYSdkBannerVC alloc]init];
                vc.adId = @"ZY83109201137110201";
                vc.number = number;
                [self.navigationController pushViewController:vc animated:YES];
            }
            break;
        case 30:
            {
                DDDAdZYSdkBannerVC *vc = [[DDDAdZYSdkBannerVC alloc]init];
                vc.adId = @"ZY89709201137112301";
                vc.number = number;
                [self.navigationController pushViewController:vc animated:YES];
            }
            break;
            
        default:
            break;
    }
    
}

#pragma mark-- 懒加载
- (UIButton *)textBtn {
    if (!_textBtn) {
        _textBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _textBtn.frame = CGRectMake(15.0, 160.0, [UIScreen mainScreen].bounds.size.width - 30.0, 45.0);
        [_textBtn setTitle:@"测试激励视频" forState:UIControlStateNormal];
        [_textBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _textBtn.backgroundColor = [UIColor redColor];
        [_textBtn addTarget:self action:@selector(clickBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        _textBtn.tag = 10;
    }
    return _textBtn;
}
- (UIButton *)bannerBtn {
    if (!_bannerBtn) {
        _bannerBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _bannerBtn.frame = CGRectMake(15.0, 220.0, [UIScreen mainScreen].bounds.size.width - 30.0, 45.0);
        [_bannerBtn setTitle:@"纯图" forState:UIControlStateNormal];
        [_bannerBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _bannerBtn.backgroundColor = [UIColor redColor];
        [_bannerBtn addTarget:self action:@selector(clickBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        _bannerBtn.tag = 20;
    }
    return _bannerBtn;
}
- (UIButton *)bannerTextBtn {
    if (!_bannerTextBtn) {
        _bannerTextBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _bannerTextBtn.frame = CGRectMake(15.0, 280.0, [UIScreen mainScreen].bounds.size.width - 30.0, 45.0);
        [_bannerTextBtn setTitle:@"图文" forState:UIControlStateNormal];
        [_bannerTextBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
        _bannerTextBtn.backgroundColor = [UIColor redColor];
        [_bannerTextBtn addTarget:self action:@selector(clickBtnAction:) forControlEvents:UIControlEventTouchUpInside];
        _bannerTextBtn.tag = 30;
    }
    return _bannerTextBtn;
}
- (UITextField *)changeLoadNumberTextField {
    if (!_changeLoadNumberTextField) {
        _changeLoadNumberTextField = [[UITextField alloc]initWithFrame:CGRectMake(15.0, 100.0, [UIScreen mainScreen].bounds.size.width - 30.0, 45.0)];
        _changeLoadNumberTextField.text = @"1";
        _changeLoadNumberTextField.placeholder = @"请输入banner加载个数";
        _changeLoadNumberTextField.keyboardType = UIKeyboardTypeNumberPad;
    }
    return _changeLoadNumberTextField;
}
@end
